import Vue from 'vue'

Vue.directive('flex', {
	inserted: function (el, binding) {
		if(binding.value) {
			el.style.flex = binding.value
		}
	}
})


Vue.directive('color', {
	inserted: function (el, binding) {
		if(binding.value) {
			el.style.color = binding.value
		}
	}
})

Vue.directive('page-top', {
	inserted : function(el){
		let e = document.createElement('div')
		e.className = 'page-top'
		el.prepend(e)
	}
})

Vue.directive('size', {
	inserted : function(el, binding){
		var keys = Object.keys(binding.modifiers)
		keys.forEach(key => {
			el.style[key] = binding.value / 19.2 + 'rem'
		})
	}
})
